/**
 * Created by Killer on 2016/1/2.
 */
$(document).ready(function () {

    //检测是否已经登陆，防止重复登陆
    $.ajax({
        url: "/fallwings/login/checkLogin",
        type: "get",
        statusCode: {
            200: function () {
                window.location.href = "index.html";
            },
            401: function () {
                $.getScript("/fallwings/static/register/js/scripts.js");
            }
        }
    });

    $("#sign").click(function(){
        var userInfo=$("#userInfo_register_form").serializeArray();
        var userInfo_String=JSON.stringify(userInfo);
        var userInfo_object=JSON.parse(userInfo_String);
        if($("#userId").val()!=""&&$("#password-again").val()!=""){
            $.ajax({
                url:"/fallwings/register",
                data:userInfo_object,
                type:"post",
                statusCode:{
                    200:function(){
                        window.location.href="/fallwings/login.html";
                    }
                }
            })
        }


    });

});